package cn.xjt.demo03;

/**
 * @author xujiangtao
 * @create 2020-07-31-20:10
 */
public class TestLamda {
    //第1步简化->静态内部类
    static class son2 implements Like{

        @Override
        public void lamda() {
            System.out.println("i'm lamda2");
        }
    }
    public static void main(String[] args) {
        Like s = new son1();
        s.lamda();
        s=new son2();
        s.lamda();
        //第2步简化->局部内部类
        class son3 implements Like{

            @Override
            public void lamda() {
                System.out.println("i'm lamda3");
            }
        }
        s=new son3();
        s.lamda();
        //第3步简化->匿名内部类
        s=new Like() {
            @Override
            public void lamda() {
                System.out.println("i'm Lamda4");
            }
        };
        s.lamda();
        //第4步简化->Lamda
        s= ()-> {
                System.out.println("i'm Lamda5");
            };
        s.lamda();
    }
}
//接口类
interface Like{
    void lamda();
}
//正常实现类
class son1 implements Like{

    @Override
    public void lamda() {
        System.out.println("i'm lamda");
    }
}
